package com.qx.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qx.entity.Modules;
import com.qx.service.ModulesService;
@CrossOrigin(origins="*")
@Controller
@RequestMapping("/modules")
public class ModulesController {
	@Autowired
	ModulesService mservice;
	
	@RequestMapping(value="/getTreeAll",method=RequestMethod.GET)
	@ResponseBody
	public Object getTreeAll() {
		return mservice.GetTreeAll();
	}
	
	@RequestMapping(value="/getSelAll",method=RequestMethod.GET)
	@ResponseBody
	public List<Map<String, String>> getSelAll() {
		return mservice.GetSelAll();
	}
	
	@RequestMapping(value="/save",method=RequestMethod.POST)
	@ResponseBody
	public Integer SaveAndFlush(Modules m) {
		return mservice.SaveAndFlush(m);
	}
	
	@RequestMapping(value="/delModules",method=RequestMethod.DELETE)
	@ResponseBody
	public Integer DeleteModules(Integer id) {
		return mservice.DeleteModules(id);
	}
	//查询用户拥有的模块
	@RequestMapping(value="/getUsrsMo",method=RequestMethod.GET)
	@ResponseBody
	public Object getUsrsMo(String name) {
		List<Map<String, Object>>list=mservice.getUserMo(name);
		System.out.println("这里是角色的模块");
		System.out.println(list);
		return list;
	}
}
